using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.IO;
using System.Diagnostics;

namespace VSTSUnitTestReport
{
    class Program
    {
        
        static int Main(string[] args)
        {
            System.Diagnostics.EventLog eventLog = new System.Diagnostics.EventLog();
            //if (!System.Diagnostics.EventLog.SourceExists("VSTSTestReport"))
            //{
            //    System.Diagnostics.EventLog.CreateEventSource("VSTSTestReport", "Application");
            //}
            int quiet = 0; // Logging to console on by default

            //eventLog.Source = "VSTSTestReport";

            string message = "Usage: VSTSTestReport /q <input trx file> <output html file> <input code coverage file>\n\t/q\toptional argument for quiet mode";
            string input;
            string output;
            string codecoverage;
            if (args.Length < 2)
            {
                Console.WriteLine(message);
                //eventLog.WriteEntry(message, EventLogEntryType.Error);
                return 1;
            }
            else if (args.Length == 2)
            {
                input = args[0];
                output = args[1];
                codecoverage = string.Empty;
            }
            else
            {
                input = args[0];
                output = args[1];
                codecoverage = args[2];
            }
            GenerateReport report = new GenerateReport(eventLog);
            //if (false == report.VerifyInputs(args, message, ref input, ref output, ref codecoverage, ref quiet))
            //{
            //    return 1;
            //}
            return report.MyMain(input, output, codecoverage);
        }
    }
}
